package com.sali.b_design_pattern.j_builder_pattern.lesson_01;

/**
 * @description:
 * @author: zhang hang
 * @date: 2023/3/18 23:11.
 * @version: 1.0
 */
public class UserBuilder {

    private User user = new User();

    public static UserBuilder builder() {
        return new UserBuilder();
    }

    public UserBuilder id(Long id) {
        user.setId(id);
        return this;
    }

    public UserBuilder username(String username) {
        user.setUsername(username);
        return this;
    }

    public UserBuilder password(String password) {
        user.setPassword(password);
        return this;
    }

    public UserBuilder age(Integer age) {
        user.setAge(age);
        return this;
    }

    public UserBuilder address(String address) {
        user.setAddress(address);
        return this;
    }

    public User build() {
        return user;
    }

}
